<!DOCTYPE html>
<html>
    <head>
        <title>ch4.html</title>
        <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
        <meta http-equiv="description" content="this is my page">
        <meta http-equiv="content-type" content="text/html; charset=UTF-8">
        <!--<link rel="stylesheet" type="text/css" href="./styles.css">-->
		<h2>This is ch5 page. 
        </h2>
        <script type="text/javascript">
        	var colors = new Array();
			colors.push("red","green");
			document.write(colors);
			document.write("<br/>");
			colors.push("black");
			document.write(colors.shift());
			document.write("<br/>");
			var now = new Date();
			document.write(now.toLocaleString());
			document.write("<br/>");
			document.write(now.toString());
			document.write("<br/>");
			var pattern1 = /\[bc\]at/i;
			document.write(pattern1.toString() + "<br/>" + pattern1.global + "<br/>");
			document.write(pattern1.ignoreCase + "<br/>");
			var pattern2 = /.at/gi;
			var text = "cat, bat, sat, fat";
			var matches = pattern2.exec(text);
			document.write(matches.index + " " + matches.length + " " + matches[0]);
			document.write("<br/>");
			var matches = pattern2.exec(text);
			document.write(matches.index + " " + matches.length + " " + matches[0]);
			document.write("<br/>");
			var matches = pattern2.exec(text);
			document.write(matches.index + " " + matches.length + " " + matches[0]);
			document.write("<br/>");
			var matches = pattern2.exec(text);
			document.write(matches.index + " " + matches.length + " " + matches[0]);
			document.write("<br/>");
			var pattern3 = /mom( and dad( and baby)?)?/gi;
			text = "mom and dad and baby";
			matches = pattern3.exec(text);
			for(var i=0;i<matches.length;i++)
			{
				document.write(matches[i]);
				document.write("<br/>");
			}
			function sum(num1,num2){
				return num1+num2;
			}
			function callSum1(num1,num2){
				return sum.apply(this,arguments);
			}
			function callSum2(num1,num2){
				return sum.apply(this,[num1,num2]);
			}
			document.write(callSum1(10,10));
			document.write("<br/>");
			document.write(callSum2(10,10));
			document.write("<br/>");
			
        </script>
    </head>
    <body>
        <a href="/myjsstudy">back</a>
    </body>
</html>